package com.ysu.zyw.other.security;

import com.ysu.zyw.dao.BlogUserMapper;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Created by zhang_yao_wu1993 on 15/4/24.
 *
 * @author by Zerur
 */
@Component("blogUserDetailsService")
public class BlogUserDetailsService implements UserDetailsService {
    private BlogUserMapper blogUserMapper;

    public BlogUserMapper getBlogUserMapper() {
        return blogUserMapper;
    }

    @SuppressWarnings("all")
    @Resource
    public void setBlogUserMapper(BlogUserMapper blogUserMapper) {
        this.blogUserMapper = blogUserMapper;
    }

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return blogUserMapper.selectBlogUserDetailsByUsername(username);
    }
}
